package name.marz.to.go.ahg.SMBC.executer;

import java.net.URI;
import java.util.List;

import name.marz.to.go.ahg.core.AutoGetterHttpClient;
import name.marz.to.go.ahg.core.Parameters;
import name.marz.to.go.ahg.core.checker.DocumentChecker;
import name.marz.to.go.ahg.core.executer.AbstractLoginExecuter;

import org.apache.http.NameValuePair;

/**
 * @author mgoto
 *
 */
public class SMBCLoginExecuter extends AbstractLoginExecuter {
	private final Parameters p;
	DocumentChecker checker = new SMBCLoginChecker();

	/**
	 * @param uri
	 * @param client
	 * @param p
	 */
	public SMBCLoginExecuter(URI uri, AutoGetterHttpClient client, Parameters p) {
		super(uri, client);
		this.p = p;
	}

	@Override
	protected List<NameValuePair> getRequestParameters() {
		String userName1 = userIdentifiers[0];
		String userName2 = userIdentifiers[1];
		String uid = userName1 + userName2;
		p.put("USRID1", userName1);
		p.put("USRID2", userName2);
		p.put("USRID", uid);
		p.put("PASSWORD", getUserPass());
		p.put("LOGIN_TYPE", "0");
		return p.getNameValueList();
	}

	@Override
	protected DocumentChecker getChecker() {
		return checker;
	}
}